package com.globallogic.draw;

public class Square extends DrawObject implements Drawable {
    
	public Square(int sideLenght) {

		if (sideLenght <= 0) {
			
			throw new IllegalArgumentException();
			
		}
		
		this.sideLenght = sideLenght;
        this.drawChar = 's';		
	}

	public float calculateSquare() {

		return sideLenght*sideLenght;
		
	}
	
	public boolean isPointInside(int x, int y) {
		
		return ((x > 0) && (x < sideLenght) && (y > 0) && (y < sideLenght));
		
	}
	
	@Override
	public String toString() {
		
		return this.getClass().getSimpleName();
		
	}

	private int sideLenght;

	@Override
	public int getLenght() {

		return sideLenght;
		
	}
	
}
